package com.zjhcsoft.shop.dao.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import com.zjhcsoft.common.dao.MybatisCommonDao;
import com.zjhcsoft.common.object.GridObj;
import com.zjhcsoft.common.object.OrderObj;
import com.zjhcsoft.common.object.PageObj;
import com.zjhcsoft.shop.dao.HistoryDao;
import com.zjhcsoft.shop.dao.ProductDao;
import com.zjhcsoft.shop.dao.UserDao;
import com.zjhcsoft.shop.model.History;
import com.zjhcsoft.shop.model.Product;
import com.zjhcsoft.shop.model.User;

@SuppressWarnings("unchecked")
@Repository
public class HistoryDaoImpl extends MybatisCommonDao<History, Long> implements HistoryDao{
	
	private static final Logger logger = Logger.getLogger(HistoryDaoImpl.class);
	
	public HistoryDaoImpl(){
		super.tableName="product";
		super.primaryKeyName="id";
	}
	/* (non-Javadoc)
	 * @see com.zjhcsoft.shop.dao.impl.HistoryDao#getHistoryByLoginName(java.lang.String)
	 */
	public  List<History>  getHistoryByLoginName(String  loginName){
		List<History> list=null;
		 try {
			String sql="select * from history where loginName='"+loginName+"' ORDER BY  browseTime desc  limit 10 ";
			list = super.excuteQuerySql(History.class, sql);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			logger.error(e.getMessage());
		}
		return list;
	}
	
}
